Skip to content

feat: implement issue #1650 — [qa-lead S7] Stop posting persona advisories under a human maintainer's PAT - #1694

Merged
don-petry merged 12 commits into
mainfrom
dev-lead/issue-1650-20260907-1509
Sep 8, 2026
Merged

don-petry merged 12 commits into
mainfrom
dev-lead/issue-1650-20260907-1509

Conversation

@don-petry

@don-petry don-petry commented Sep 7, 2026 •

Copy link
Copy Markdown
Collaborator

User description

Closes #1650

Implemented by dev-lead agent. Please review.


CodeAnt-AI Description

Post persona advisories under the declared machine identity

What Changed

  • Advisory personas now post as donpetry-bot instead of the human maintainer account.
  • Each persona's posting account and credential come from its manifest; unsupported credentials, missing secrets, or tokens authenticated as the wrong account stop posting instead of falling back silently.
  • Removed the shared workflows PAT fallback and kept the owner PAT only for the dev-lead advisory path until its commit and advisory identities are split.
  • Added identity-resolution tests and local manifest validation, including checks that shipped personas use supported credentials.

Impact

✅ Machine-user bylines for persona advisories
✅ Fewer recursion loops from bot-authored advisories
✅ No comments posted with the wrong account or credential

💡 Usage Guide

Checking Your Pull Request

Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.

Talking to CodeAnt AI

Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:

@codeant-ai ask: Your question here

This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.

Example

@codeant-ai ask: Can you suggest a safer alternative to storing this secret?

Preserve Org Learnings with CodeAnt

You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:

@codeant-ai: Your feedback here

This helps CodeAnt AI learn and adapt to your team's coding style and standards.

Example

@codeant-ai: Do not flag unused imports.

Retrigger review

Ask CodeAnt AI to review the PR again, by typing:

@codeant-ai: review

Check Your Repository Health

To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.

@qodo-code-review

Copy link
Copy Markdown

ⓘ Qodo reviews are paused because your trial has ended. Ask your workspace admin to add credits to resume reviews. Manage billing

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@codeant-ai

codeant-ai Bot commented Sep 7, 2026 •

Copy link
Copy Markdown

🤖 CodeAnt AI — Review Status

Status Commit Started (UTC) Finished (UTC)
✅ Incremental review completed 1fb964c Sep 07, 2026 · 22:33 22:33
✅ Incremental review completed aeacd4e Sep 07, 2026 · 21:20 21:21
✅ Reviewed your PR 708443b Sep 07, 2026 · 15:21 15:24

@codeant-ai

codeant-ai Bot commented Sep 7, 2026

Copy link
Copy Markdown

Thanks for using CodeAnt! 🎉

We're free for open-source projects. if you're enjoying it, help us grow by sharing.

Share on X ·
Reddit ·
LinkedIn

@coderabbitai

coderabbitai Bot commented Sep 7, 2026 •

Copy link
Copy Markdown

Important

Approval pending

CodeRabbit has no unresolved comments, but it could not review the latest commit because the review limit was reached. Follow the review guidance in this comment to continue.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codeant-ai codeant-ai Bot added the size:L This PR changes 100-499 lines, ignoring generated files label Sep 7, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates several persona manifests to use the machine bot account donpetry-bot and its corresponding credential DON_PETRY_BOT_GH_PAT instead of the human owner account don-petry for runtime identity. The dev-lead persona is kept as don-petry with an explanatory note regarding the need for a commit-vs-advisory identity split. Additionally, a new BATS test suite tests/resolve_persona_identity.bats is introduced to verify persona posting-identity resolution. Feedback suggests using $BATS_TEST_TMPDIR directly in the BATS tests instead of manually creating temporary directories with mktemp -d to ensure automatic per-test isolation and cleanup.

Comment thread tests/resolve_persona_identity.bats Resolved
Comment thread tests/resolve_persona_identity.bats Resolved
… setup

- Fix GH_TOKEN expression using if() instead of && || operators to prevent
  silent fallthrough to wrong PAT when DON_PETRY_BOT_GH_PAT secret is unset
- Simplify BATS test tmpdir setup to use $BATS_TEST_TMPDIR directly per
  framework best practices for automatic per-test isolation and cleanup

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
@don-petry

Copy link
Copy Markdown
Collaborator Author

Dev-Lead — fix-bot-comment (applied)

Changes committed and pushed.

@don-petry
don-petry force-pushed the dev-lead/issue-1650-20260907-1509 branch from 3f464e7 to e9c137a Compare September 7, 2026 15:32
@don-petry
don-petry enabled auto-merge (squash) September 7, 2026 15:32
@donpetry-bot

Copy link
Copy Markdown
Contributor

CI checks on this PR are still running. Once they complete, re-mention @donpetry-bot to trigger a fresh review.

Posted by the donpetry-bot PR-review cascade.

@don-petry
don-petry disabled auto-merge September 7, 2026 15:44
@don-petry

Copy link
Copy Markdown
Collaborator Author

Dev-Lead — fix-bot-comment (applied)

Changes committed and pushed.

@don-petry
don-petry enabled auto-merge (squash) September 7, 2026 15:46
@don-petry
don-petry disabled auto-merge September 7, 2026 15:50
@don-petry

Copy link
Copy Markdown
Collaborator Author

Dev-Lead — fix-bot-comment (no-changes)

Agent reasoning
- One check (`bats`) is in_progress — waiting for completion
**Review State:**
- `codeant-ai[bot]`: COMMENTED (empty body)
- `gemini-code-assist[bot]`: COMMENTED with summary only (no CHANGES_REQUESTED)
- No Tier 1 blockers (no CHANGES_REQUESTED reviews)
## Summary
**Issues addressed:** 0  
**Tier 1 blockers:** None  
**Status:** No actionable changes required — the PR passes all quality gates with no code issues to fix.
The PR is clean. Once the in-progress `bats` check completes successfully, it will be ready to merge.

@don-petry
don-petry enabled auto-merge (squash) September 7, 2026 15:51
donpetry-bot
donpetry-bot previously approved these changes Sep 7, 2026

@donpetry-bot donpetry-bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated review — APPROVED ✓

Risk: MEDIUM
Reviewed commit: 4b656df46052c287b3a6e893b8e5d388b67e035b
Cascade: triage → audit (triage: haiku 4.5 → deep: opus 4.8 + duck: o4-mini → audit: fable 5)

Summary

PR #1694 moves persona advisory posting from a human maintainer's PAT to a manifest-driven bot identity (donpetry-bot / DON_PETRY_BOT_GH_PAT), which is a net security improvement: it restores the router's two-axis recursion guard and removes owner-level author_association from agent output (#1650). Independent audit verified fail-closed behavior at three layers (credential allowlist, empty-token guard, gh api user login verification), no expression-injection or path-traversal vectors (persona id is slug-validated in pr_valid_persona_id before any path interpolation, and all workflow expressions pass through env:), no secret values in logs, and no interface break (sole caller uses secrets: inherit). Risk is MEDIUM only because the change touches Actions credential selection; no defects found. Approved.

Findings

  • INFO [auth]: Audit-verified: inputs.persona from the repository_dispatch payload is re-validated by pr_valid_persona_id (lower-kebab slug only, no '/', '.', or uppercase) in the resolve step before the new identity step interpolates it into personas//persona.yml — path traversal is not possible. Malformed ids fail loudly (rc 2), not as a benign skip. (.github/workflows/persona-runner-reusable.yml line 140)
  • INFO [injection]: No GitHub Actions expression injection: all dynamic values (inputs.persona, steps.identity.outputs.*) are passed to run blocks via env:, never interpolated directly into scripts. Identity-step outputs derive from repo-controlled persona.yml files, which require write access to alter. (.github/workflows/persona-runner-reusable.yml line 227)
  • INFO [auth]: Fail-closed posting path confirmed: credential constrained to {DON_PETRY_BOT_GH_PAT, GH_PAT_DON_PETRY} with loud failure otherwise; empty selected token aborts; 'gh api user -q .login' must equal the manifest account or the workflow exits 1. The agent step still never receives any posting PAT (github.token only) — the #860 marker-enforcement boundary is preserved. (.github/workflows/persona-runner-reusable.yml line 260)
  • INFO [secret]: No secret leakage: diff and error paths print account/credential NAMES only, never token values. Removing GH_PAT_WORKFLOWS from the secrets block reduces the reusable's credential surface (least privilege); the sole in-repo caller uses 'secrets: inherit', so it is not a breaking interface change. (.github/workflows/persona-runner-reusable.yml line 78)
  • INFO [maintainability]: dev-lead deliberately retains don-petry/GH_PAT_DON_PETRY because its single identity field serves both the commit path (must be owner) and the advisory path; the commit-vs-advisory split is documented as a tracked follow-up. Until that lands, dev-lead advisories still post under a human account — a documented, scoped residual of the #1650 fix, not a defect in this PR. (personas/dev-lead/persona.yml line 91)

Reviewed by the PR-review cascade (triage: haiku 4.5 → deep: opus 4.8 + duck: o4-mini → audit: fable 5). Reply if you need a human review.

@don-petry
don-petry disabled auto-merge September 7, 2026 16:02
@don-petry

Copy link
Copy Markdown
Collaborator Author

Dev-Lead — review-changes (applied)

Changes committed and pushed.

@don-petry
don-petry disabled auto-merge September 7, 2026 22:12
@don-petry

Copy link
Copy Markdown
Collaborator Author

Dev-Lead — fix-bot-comment (no-changes)

Agent reasoning
**PR State:**
- All completed CI checks: ✓ success or skipped (no failures)
- In-progress checks: `bats` and `unit` (still running, not failed)
- Reviews: No `CHANGES_REQUESTED` state
- No Tier 1 blockers (failures, timeouts, cancellations, or change requests)
**Bot Comment Type:** This is a **neutral, positive overview** — SonarCloud is confirming the PR passes quality gates with no defects found. Per the task instructions: *"A neutral overview is not an actionable finding… there is nothing to fix."*
The `gemini-code-assist[bot]` comment mentions a suggestion about using `$BATS_TEST_TMPDIR` in tests, but this is informational feedback, not a blocking issue.
## Conclusion
**No actionable issues found.** The PR passes all quality gates with zero code defects, security hotspots, or issues reported by SonarCloud. There are no Tier 1 blockers to address.
Two test jobs are still in progress (`bats` and `unit`), but there are no failed checks yet. Once those complete successfully, the PR will be fully clean.

@don-petry
don-petry enabled auto-merge (squash) September 7, 2026 22:12
@donpetry-bot

Copy link
Copy Markdown
Contributor

Advisory bots were rate-limited; auto-approval is withheld until they recover. pr-review-sweep will re-review this PR after 2026-09-07T23:21:38Z.

@don-petry
don-petry disabled auto-merge September 7, 2026 22:24
@don-petry

Copy link
Copy Markdown
Collaborator Author

Dev-Lead — fix-bot-comment (no-changes)

Agent reasoning
**CI Status:** All checks completed successfully (46 passed, 7 skipped). No failures, timeouts, or action-required statuses.
**Reviews:**
- `codeant-ai[bot]` - COMMENTED (empty body)
- `donpetry-bot` - DISMISSED with APPROVED review (audit complete)
- `gemini-code-assist[bot]` - COMMENTED with a suggestion about using `$BATS_TEST_TMPDIR` in BATS tests instead of `mktemp -d`
**Tier 1 Blockers:** None present (no failed checks, no CHANGES_REQUESTED reviews)
## Conclusion
Per the task instructions: *"A neutral overview is not an actionable finding... do not revert or undo the PR's own changes to 'address' it."*
The SonarCloud comment is a clean bill of health, not a bug report. The gemini-code-assist comment is a best-practice suggestion on BATS testing patterns, not a defect—and the instructions state not to fix issues marked as suggestions unless they indicate a real bug.
**No actionable fixes required.** All quality gates passed, no blockers exist, and the PR is ready.

@don-petry
don-petry enabled auto-merge (squash) September 7, 2026 22:24
@codeant-ai codeant-ai Bot added size:XL This PR changes 500-999 lines, ignoring generated files and removed size:L This PR changes 100-499 lines, ignoring generated files labels Sep 7, 2026
@sonarqubecloud

sonarqubecloud Bot commented Sep 7, 2026

Copy link
Copy Markdown

@donpetry-bot

Copy link
Copy Markdown
Contributor

Advisory bots were rate-limited; auto-approval is withheld until they recover. pr-review-sweep will re-review this PR after 2026-09-07T23:41:43Z.

@don-petry
don-petry disabled auto-merge September 7, 2026 22:43
@don-petry

Copy link
Copy Markdown
Collaborator Author

Dev-Lead — fix-bot-comment (no-changes)

Agent reasoning
Issues addressed: 0
- Quality Gate Passed (neutral overview, no defects identified)
Files changed: None
Skipped (informational): Quality Gate Passed summary
```

@don-petry
don-petry enabled auto-merge (squash) September 7, 2026 22:43

@donpetry-bot donpetry-bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated review — APPROVED ✓

Risk: MEDIUM
Reviewed commit: 1fb964cf9975f881fa6329f92a861ddbb4d12520
Cascade: triage → deep (triage: haiku 4.5 → deep: opus 4.8 + duck: o4-mini → audit: fable 5)

Summary

PR #1694 migrates persona advisory posting from the human maintainer account (don-petry/GH_PAT_DON_PETRY) to the machine bot (donpetry-bot/DON_PETRY_BOT_GH_PAT), driven by per-persona manifest declarations rather than a repo-wide default. The credential routing is fail-closed at three independent layers (credential allowlist, empty-token guard, and gh-api identity verification), no expression-injection or path-traversal vectors are present, no secret values appear in logs, and all CI checks pass green. Risk is MEDIUM solely because the change touches Actions credential selection logic; no defects were found.

Findings

  • INFO: Identity resolution step reads account+credential from personas//persona.yml runtime.identity and validates the declared credential against an explicit allowlist (DON_PETRY_BOT_GH_PAT | GH_PAT_DON_PETRY); any other declared credential causes an immediate exit 1 with a descriptive error — fail-closed, not a silent fallback. (.github/workflows/persona-runner-reusable.yml:140)
  • INFO: Three-layer fail-closed posting path confirmed: (1) credential allowlist in the resolve step; (2) empty-token guard ([ -z "${GH_TOKEN:-}" ] → exit 1); (3) gh api user -q .login identity verification — if the token authenticates as any account other than the manifest-declared one, the workflow exits 1 and refuses to post. The agent step still never receives any posting PAT (github.token only). (.github/workflows/persona-runner-reusable.yml:186)
  • INFO: No GitHub Actions expression injection: all dynamic values (inputs.persona, steps.identity.outputs.*) reach run blocks only via env: — never interpolated directly into scripts. The persona id is slug-validated by pr_valid_persona_id before any path interpolation, ruling out path traversal. (.github/workflows/persona-runner-reusable.yml)
  • INFO: No secret values appear in logs or error output; only credential NAMES and account login strings are printed. Removing GH_PAT_WORKFLOWS (previously required: true) from the secrets block reduces the reusable's credential surface. The sole in-org caller uses secrets: inherit, so this is not a breaking interface change. (.github/workflows/persona-runner-reusable.yml:78)
  • INFO: dev-lead deliberately retains don-petry/GH_PAT_DON_PETRY because its single runtime.identity field serves both the commit path (must be owner) and the advisory path (should be bot). The conflict is clearly documented as a tracked follow-up. This is a scoped, documented residual of the #1650 fix, not a defect. (personas/dev-lead/persona.yml:91)
  • MINOR: The gh api user call uses '2>/dev/null || true', so a transient GitHub API failure will set actual_login to an empty string, causing the identity check to fail with a confusing error message ('authenticates as , not the manifest identity ...'). This is fail-closed behavior (good — no accidental wrong-identity posting), but the error message could mislead operators into thinking the PAT is wrong rather than the API being transiently unavailable. Consider adding a distinct check for empty actual_login to emit a clearer 'API call failed' message. (.github/workflows/persona-runner-reusable.yml:203)
  • INFO: validate-personas job now uses a local standards/personas/persona.schema.json (ADR-0006-conformant) instead of fetching from petry-projects/.github. The local schema is comprehensive (353 lines) and correctly encodes the shared-runtime vs dedicated-reusable distinction. This removes the cross-repo dependency that previously caused the job to go red until the companion PR merged. (.github/workflows/lint.yml:46)
  • INFO: New BATS suite (tests/resolve_persona_identity.bats) pins the fail-loud identity resolution contract: manifest-driven identity, fail on missing identity block, and an allowlist sweep over all shipped personas. The sweep test uses 'return 1' inside the for loop which correctly signals test failure in BATS. All bats and unit-tests CI checks passed green. (tests/resolve_persona_identity.bats)
  • INFO: All CI checks completed successfully at head SHA 1fb964c: gitleaks (no secrets), ShellCheck, actionlint, CodeQL (actions+python), SonarCloud (0 new issues, 0 security hotspots), bats, unit-tests, verify-persona-identity, and all structural lint jobs. Two Test-Deletion Guard runs show CANCELLED (not FAILED) — these are superseded-run cancellations from earlier pushes, not failures at head. (n/a)

Reviewed by the PR-review cascade (triage: haiku 4.5 → deep: opus 4.8 + duck: o4-mini → audit: fable 5). Reply if you need a human review.

@don-petry
don-petry disabled auto-merge September 8, 2026 03:08
@don-petry

Copy link
Copy Markdown
Collaborator Author

Dev-Lead — fix-reviews (no-changes)

Agent reasoning
Addressed 1 thread:
- Thread PRRT_kwDOR9SdIs6f9uFM (codeant-ai, bot): "test accepts any credential" — already addressed by the allowlist sweep test (tests/resolve_persona_identity.bats:91-106), which matches the runner allowlist at persona-runner-reusable.yml:156 and token map at :248-251 [replied + resolved]
Test verification: pass — 7/7 tests pass in tests/resolve_persona_identity.bats (including the allowlist sweep)
Files changed: none (fix already committed on this branch; no new changes required)
```
The codeant-ai concern was that the suite would stay green even if the workflow allowlist/token-map rejected a declared credential. That gap was already closed on this branch by test 7, which fails CI if any shipped persona declares a credential the runner holds no PAT for. I verified it runs green and resolved the bot thread with a reply describing the fix.

@don-petry
don-petry merged commit 9e70936 into main Sep 8, 2026
74 of 83 checks passed
@don-petry
don-petry deleted the dev-lead/issue-1650-20260907-1509 branch September 8, 2026 03:09

@donpetry-bot donpetry-bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated review — APPROVED ✓

Risk: MEDIUM
Reviewed commit: 1fb964cf9975f881fa6329f92a861ddbb4d12520
Cascade: triage → audit (triage: haiku 4.5 → deep: opus 4.8 + duck: o4-mini → audit: fable 5)

Summary

PR #1694 removes the broadly-scoped GH_PAT_WORKFLOWS fallback and makes each persona's posting identity manifest-driven, with a credential allowlist, empty-token fail-closed exit, and a gh-api-user login check that refuses to post under any identity other than the manifest-declared account. Independent verification confirms the cross-repo prerequisites the deep review deferred: the persona-mention router's job-level guard already excludes donpetry-bot (two-axis recursion protection restored), and the caller persona-runner.yml uses secrets: inherit so DON_PETRY_BOT_GH_PAT (provably provisioned — donpetry-bot posted this PR's approving review) flows without caller changes. This is a strict security improvement in a HIGH-taxonomy area, implemented fail-closed throughout; all CI gates including gitleaks, CodeQL, verify-persona-identity, and bats are green at head SHA 1fb964c.

Findings

  • INFO: Verified cross-repo (deep review AC4 handoff): petry-projects/.github persona-mention-reusable.yml job-level if excludes comment authors donpetry-bot and github-actions[bot], plus the '<!-- persona:' marker axis. Advisories posted as donpetry-bot cannot re-trigger the router — two-axis recursion protection confirmed.
  • INFO: Deep review's caller-coordination concern is resolved: the dispatch receiver persona-runner.yml uses secrets: inherit, so removing GH_PAT_WORKFLOWS from the reusable's secrets block and adding DON_PETRY_BOT_GH_PAT requires no caller change. The org secret demonstrably exists and works — donpetry-bot posted this PR's approving review via the same credential.
  • INFO: No injection surface introduced: all dynamic values (inputs.persona, step outputs) reach run blocks via env, never inline ${{ }}. scripts/lib/resolve-persona-identity.sh is fail-closed (exits non-zero on missing manifest/identity/field, never a silent default); persona id reaches it only via repository_dispatch, which requires a repo-scope credential to fire, so the path-construction input is not attacker-controlled.
  • INFO: PAT confinement preserved and tightened: posting PATs exist only in the final workflow-owned post step; the agent step keeps github.token only. The identity step allowlists credential to {DON_PETRY_BOT_GH_PAT, GH_PAT_DON_PETRY} and errors on anything else; the post step exits on an empty token and verifies gh api user login equals the manifest account before posting. Wrong-identity posting (the #1650 regression class) is structurally blocked, failing closed on transient API errors as well.
  • MINOR: validate-personas now validates against a local schema copy (standards/personas/persona.schema.json) instead of fetching the canonical schema from petry-projects/.github; the local $id still points at the canonical URL. This is deliberate (implements ADR-0006 shared-runtime/canary distinction) and removes a remote-fetch moving part, but the two copies can now drift. Track re-convergence with the canonical schema repo.
  • INFO: dev-lead intentionally retains GH_PAT_DON_PETRY because its single identity field serves both the commit path (owner) and advisory path (bot); the split is filed as follow-up. Acceptable residual: dev-lead advisories continue under the human PAT until then, protected by the marker axis only.

Reviewed by the PR-review cascade (triage: haiku 4.5 → deep: opus 4.8 + duck: o4-mini → audit: fable 5). Reply if you need a human review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XL This PR changes 500-999 lines, ignoring generated files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[qa-lead S7] Stop posting persona advisories under a human maintainer's PAT

2 participants